package com.project.slsx.activity;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.project.slsx.R;
import com.project.slsx.adapter.StorageListAdapter;
import com.project.slsx.bean.StorageBean;

import java.util.ArrayList;

/**
 * 入库列表
 */
public class StoreageListActivity extends BaseActivity implements View.OnClickListener {

    private static final String TAG = StoreageListActivity.class.getSimpleName();
    private RecyclerView recyclerview;
    private StorageListAdapter adapter;
    private TextView tvNumberTotal;
    private TextView tvProfitTotal;
    private TextView tvSumMoney;

    @Override
    public int getLayoutId() {
        return R.layout.activity_storage_list;
    }

    @Override
    public void initView() {

        findViewById(R.id.rl_back).setOnClickListener(v -> finish());
        TextView title = findViewById(R.id.tv_title);
        title.setText("入库列表");

        tvNumberTotal = findViewById(R.id.tv_storage_number);
        tvProfitTotal = findViewById(R.id.tv_storage_profit);
        tvSumMoney = findViewById(R.id.tv_storage_sum_money);

        findViewById(R.id.btn_storage_addstorage).setOnClickListener(this);

        recyclerview = findViewById(R.id.recyclervew_storage_list);
        recyclerview.setLayoutManager(new LinearLayoutManager(this));
        adapter = new StorageListAdapter(R.layout.layout_item_storage_list);
        recyclerview.setAdapter(adapter);
    }

    @Override
    public void initData() {
        StorageBean.ResultBean resultBean = (StorageBean.ResultBean) getIntent().getSerializableExtra("storebean");
        ArrayList<StorageBean.ResultBean> list = new ArrayList<>();
        list.add(resultBean);
        adapter.setNewData(list);
        Log.i(TAG, "initData: " + resultBean);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id) {
            case R.id.btn_storage_addstorage:

                break;


        }

    }
}

